package com.tian.view

import android.content.Intent
import com.tian.view.anim.AnimActivity
import com.tian.view.common.BaseListActivity
import com.tian.view.custom.CardViewActivity
import com.tian.view.custom.HeadRecyclerViewActivity
import com.tian.view.draw.DrawActivity
import com.tian.view.touch.ViewTouchActivity

/**
 * @author tiansongtao,Email:769001510@qq.com
 * @date 2022/12/27 11:33
 */
class MainActivity : BaseListActivity() {

    override fun getRecyclerViewAdapter(): BaseRecyclerAdapter {
        val adapter = BaseRecyclerAdapter()
        adapter.itemClickListener = object : BaseRecyclerAdapter.OnItemClickListener {
            override fun onItemClick(dataHolder: BaseRecyclerAdapter.DataHolder, position: Int) {
                val start = dataHolder.o1 as Class<*>
                startActivity(Intent(this@MainActivity, start))
            }
        }
        return adapter
    }

    override fun getAdapterData(): MutableList<BaseRecyclerAdapter.DataHolder> {
        val datas = mutableListOf<BaseRecyclerAdapter.DataHolder>()
        datas.add(BaseRecyclerAdapter.DataHolder(BaseRecyclerAdapter.TYPE_COMMON_BUTTON, "NestedScrollViewRecyclerView",
                HeadRecyclerViewActivity::class.java))
        datas.add(BaseRecyclerAdapter.DataHolder(BaseRecyclerAdapter.TYPE_COMMON_BUTTON, "动画",
                AnimActivity::class.java))
        datas.add(BaseRecyclerAdapter.DataHolder(BaseRecyclerAdapter.TYPE_COMMON_BUTTON, "Draw",
                DrawActivity::class.java))
        datas.add(BaseRecyclerAdapter.DataHolder(BaseRecyclerAdapter.TYPE_COMMON_BUTTON, "view Touch 事件",
                ViewTouchActivity::class.java))
        return datas
    }


}